﻿using System;
using System.Windows.Forms;

namespace Pibby.Controls
{
	public partial class BrowsableFolder : UserControl
	{
		public BrowsableFolder()
		{
			InitializeComponent();
		}

		private void browseButton_Click(object sender, EventArgs e)
		{
			using (var browser = new FolderBrowserDialog())
			{
				browser.SelectedPath = this.folderTextBox.Text;

				if (DialogResult.OK == browser.ShowDialog())
				{
					this.Text = browser.SelectedPath;
				}
			}
		}

		public override string Text
		{
			get
			{
				return this.folderTextBox.Text;
			}
			set
			{
				this.folderTextBox.Text = value;
			}
		}

	}
}
